import typing

# 题目：求base的exceponent次方，不使用库函数，不需要考虑大叔问题


def power_with_exceponent(base:float, exceponent:int):
    if base == 0.0 and exceponent<0:
        return 0.0

    abs_exponent = exceponent
    if exceponent < 0:
        abs_exponent = -exceponent

    res = power_with_unsignedexceponent(base, abs_exponent)

    if exceponent<0:
        res = 1.0/res

    return res



def power_with_unsignedexceponent(base:float, exceponent:int):
    # if exceponent<0:
    #     return None
    if exceponent == 0:
        return 1
    if exceponent == 1:
        return base

    res = power_with_unsignedexceponent(base, exceponent>>1)
    res = res * res
    if exceponent&1 == 1:
        res *= base
    return res



if __name__ == '__main__':
    print(power_with_exceponent(4, 22))